package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.SysPurchaseOrderMapper;
import com.ruoyi.system.domain.SysPurchaseOrder;
import com.ruoyi.system.service.ISysPurchaseOrderService;

/**
 * 采购订单Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-06-29
 */
@Service
public class SysPurchaseOrderServiceImpl implements ISysPurchaseOrderService 
{
    @Autowired
    private SysPurchaseOrderMapper sysPurchaseOrderMapper;

    /**
     * 查询采购订单
     * 
     * @param orderId 采购订单主键
     * @return 采购订单
     */
    @Override
    public SysPurchaseOrder selectSysPurchaseOrderByOrderId(Long orderId)
    {
        return sysPurchaseOrderMapper.selectSysPurchaseOrderByOrderId(orderId);
    }

    /**
     * 查询采购订单列表
     * 
     * @param sysPurchaseOrder 采购订单
     * @return 采购订单
     */
    @Override
    public List<SysPurchaseOrder> selectSysPurchaseOrderList(SysPurchaseOrder sysPurchaseOrder)
    {
        return sysPurchaseOrderMapper.selectSysPurchaseOrderList(sysPurchaseOrder);
    }

    /**
     * 新增采购订单
     * 
     * @param sysPurchaseOrder 采购订单
     * @return 结果
     */
    @Override
    public int insertSysPurchaseOrder(SysPurchaseOrder sysPurchaseOrder)
    {
        sysPurchaseOrder.setCreateTime(DateUtils.getNowDate());
        return sysPurchaseOrderMapper.insertSysPurchaseOrder(sysPurchaseOrder);
    }

    /**
     * 修改采购订单
     * 
     * @param sysPurchaseOrder 采购订单
     * @return 结果
     */
    @Override
    public int updateSysPurchaseOrder(SysPurchaseOrder sysPurchaseOrder)
    {
        sysPurchaseOrder.setUpdateTime(DateUtils.getNowDate());
        return sysPurchaseOrderMapper.updateSysPurchaseOrder(sysPurchaseOrder);
    }

    /**
     * 批量删除采购订单
     * 
     * @param orderIds 需要删除的采购订单主键
     * @return 结果
     */
    @Override
    public int deleteSysPurchaseOrderByOrderIds(Long[] orderIds)
    {
        return sysPurchaseOrderMapper.deleteSysPurchaseOrderByOrderIds(orderIds);
    }

    /**
     * 删除采购订单信息
     * 
     * @param orderId 采购订单主键
     * @return 结果
     */
    @Override
    public int deleteSysPurchaseOrderByOrderId(Long orderId)
    {
        return sysPurchaseOrderMapper.deleteSysPurchaseOrderByOrderId(orderId);
    }
}
